package com.yibo.user.message;

import com.yibo.support.mq.YBProcess;
import com.yibo.support.pojo.YBMessage;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;

import javax.annotation.Resource;


@EnableBinding({YBProcess.class})
public class SendMsgImpl implements SendMsg{

    @Resource
    @Qualifier(YBProcess.YB_OUTPUT)
    private MessageChannel output;


    /**
     * 发送消息
     * @param message
     */
    @Override
    public void send(YBMessage message) {
        output.send(MessageBuilder.withPayload(message).build());
    }
}
